#!/bin/sh

set -e

echo "Removing unwanted files"

# Get POTFILES_DOT_IN
. /usr/share/amnesia/build/variables

find /usr/share/doc -type f -name changelog.gz        -delete
find /usr/share/doc -type f -name changelog.Debian.gz -delete
find /usr/share/doc -type f -name NEWS.Debian.gz      -delete

# Remove .in files managed by intltool
rm $POTFILES_DOT_IN

# These files are not needed after the Tor Browser has been installed
# (by the 10-tbb hook)
rm /usr/share/tails/tbb-*.txt

# Prevent races between MAC spoofing and interface naming
rm /lib/udev/rules.d/75-persistent-net-generator.rules

# Remove the snakeoil SSL key pair generated by ssl-cert
find /etc/ssl/certs /etc/ssl/private |
    while read f; do
       if [ "$(readlink -f "$f")" = "/etc/ssl/certs/ssl-cert-snakeoil.pem" ] || \
          [ "$(readlink -f "$f")" = "/etc/ssl/private/ssl-cert-snakeoil.key" ]; then
	   rm "${f}"
       fi
    done
update-ca-certificates

# Remove the kernel .map files which are only useful for kernel
# debugging (and slightly make things easier for malware, perhaps) and
# otherwise just occupy disk space.
rm -f /boot/*.map /boot/*.map-*
